//
// Created by wze-zero on 2024/7/26 026.
//
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int num, n, k;
    vector<int> v;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        cin >> num;
        v.push_back(num);
    }
    sort(v.begin(), v.end());
    vector<int>::iterator i = v.begin();
    cout << *(i + k - 1) << endl;
    cout << endl;
    return 0;
}